<template>
	<view class="wrap">
		<u-navbar :title="$t('xgjymm')" title-width="340" :border-bottom="false" back-icon-color="#fff" title-color="#fff" :background="{ backgroundColor: '#0030A8' }"></u-navbar>
		<view class="tom-container">
			<view class="list">
				<view class="row">
					<view class="row-label">{{$t('jmm')}}</view>
					<view class="row-main">
						<input type="password" v-model="Password" maxlength="6" :placeholder="$t('qsrjmm')" placeholder-class="place-class" />
					</view>
				</view>
				<view class="row">
					<view class="row-label">{{$t('xmm')}}</view>
					<view class="row-main">
						<input type="password" v-model="transferPassword" maxlength="6" :placeholder="$t('qsrxmm2')" placeholder-class="place-class" />
					</view>
				</view>
				<view class="row">
					<view class="row-label">{{$t('qrxmm')}}</view>
					<view class="row-main">
						<input type="password" v-model="confirmTransferPassword" maxlength="6" :placeholder="$t('qsrxmm')" placeholder-class="place-class" />
					</view>
				</view>
				<view class="row" style="text-align: right;">
					<navigator url="/pages/User/Personal/TradingCodes/details/details" style="color:#0032B7;font-size: 24rpx;display: inline-block;" hover-class="none">{{$t('wjmm')}}</navigator>
				</view>
				<view class="login_btn" @tap="submit">{{$t('qrxg')}}</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				Password: '', // 旧密码
				transferPassword: '', // 新密码
				confirmTransferPassword: '', //确认新密码
			}
		},
		methods: {
			// 确定
			submit() {
				if (!this.$u.test.digits(this.transferPassword) || this.transferPassword.toString().length != 6) return this.$utils
					.toast(this.$t('qsr6sz'));
				if (this.transferPassword.toUpperCase() != this.confirmTransferPassword.toUpperCase()) return this.$utils.toast(
					this.$t('lxsrbyz'))
				this.$utils.loading(this.$t('qsh'))
				this.$api.loginApi.updateTransactionPassword({
						oldTransferPassword: this.Password,
						newTransferPassword: this.transferPassword
					})
					.then(res => {
						this.$utils.toast(res.data);
						setTimeout(function(){
							uni.navigateBack()
						},1000)
					})
			},
		}
	}
</script>

<style lang="scss" scoped>
.tom-container {
	padding-top: 50rpx;
}
.list {
	flex: 1;
	display: flex;
	flex-direction: column;
	border-radius: 50rpx 50rpx 0rpx 0rpx;
	overflow: hidden;
	background-color: #fff;
	background-image: url('/static/new_images/showPopup.png');
	background-position: left bottom;
	background-repeat: no-repeat;
	background-size: 100% 800rpx;
	.row {
		margin: 30rpx;
	
		&:first-child {
			margin-top: 40rpx;
		}
	
		&-label {
			color: $tom-text-color;
			font-size: 28rpx;
			font-weight: bold;
		}
	
		&-main {
			margin-top: 28rpx;
			background-color: #FAFAFA;
			height: 68rpx;
			padding: 0 20rpx;
			display: flex;
			align-items: center;
	
			.place-class {
				color: #CCCCCC;
			}
	
			input {
				flex: 1;
				color: $tom-text-color;
				font-size: 24rpx;
			}
	
			&-tip {
				margin-left: 20rpx;
				color: $tom-text-color;
				font-size: 24rpx;
			}
		}
	}
}
</style>
